load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "aggregate",
    srcs = [
        "agg_hash_base_worker.go",
        "agg_hash_executor.go",
        "agg_hash_final_worker.go",
        "agg_hash_partial_worker.go",
        "agg_spill.go",
        "agg_stream_executor.go",
        "agg_util.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/executor/aggregate",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/executor/aggfuncs",
        "//pkg/executor/internal/exec",
        "//pkg/executor/internal/vecgroupchecker",
        "//pkg/expression",
        "//pkg/parser/mysql",
        "//pkg/parser/terror",
        "//pkg/sessionctx",
        "//pkg/sessionctx/stmtctx",
        "//pkg/sessionctx/variable",
        "//pkg/types",
        "//pkg/util",
        "//pkg/util/channel",
        "//pkg/util/chunk",
        "//pkg/util/codec",
        "//pkg/util/disk",
        "//pkg/util/execdetails",
        "//pkg/util/hack",
        "//pkg/util/logutil",
        "//pkg/util/memory",
        "//pkg/util/set",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_twmb_murmur3//:murmur3",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "aggregate_test",
    timeout = "short",
    srcs = ["agg_spill_test.go"],
    flaky = True,
    shard_count = 3,
    deps = [
        ":aggregate",
        "//pkg/executor/aggfuncs",
        "//pkg/executor/internal/exec",
        "//pkg/executor/internal/testutil",
        "//pkg/expression",
        "//pkg/expression/aggregation",
        "//pkg/parser/ast",
        "//pkg/parser/mysql",
        "//pkg/sessionctx",
        "//pkg/sessionctx/variable",
        "//pkg/types",
        "//pkg/util/chunk",
        "//pkg/util/memory",
        "//pkg/util/mock",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_stretchr_testify//require",
    ],
)
